<?php
/**
 * Created by PhpStorm.
 * User: tsy
 * Date: 2017/4/7
 * Time: 14:56
 */
namespace Admin\Model;
use Think\Model;

class ReferenceModel extends Model{
    protected $trueTableName = 'bypal_cust_reference';

    public function reference_by_custid($cust_id) {
        $sql="select t1.ref_id,t2.refertype_name,t3.status_name,FROM_UNIXTIME(t1.ref_createdate,'%Y-%m-%d') ref_createdate from bypal_cust_reference t1
              left join bypal_cust_refertype t2 on t1.ref_type=t2.refertype_id
              left join bypal_cust_status t3 on t1.ref_status=t3.status_id where t1.ref_custid='$cust_id'";

        $Model = new \Think\Model();
        $array = $Model->query($sql);

        return $array;
    }
}